package com.example.rabbitmqdemo.springbootMQ.simple;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class HelloSender1 {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send() {
        String sendMsg = "hello1 " + new Date();
        System.out.println("Sender1 : " + sendMsg);
        for (int i = 0; i < 10; i++) {
            this.amqpTemplate.convertAndSend("hello", sendMsg);
        }
    }

}